package com.atguigu.yygh.shop.controller;

import com.atguigu.yygh.common.result.Result;
import com.atguigu.yygh.shop.service.DepartmentService;
import com.atguigu.yygh.vo.hosp.DepartmentVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/shop/department")
//@CrossOrigin
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;

    //根据店铺编号，查询店铺所有科室列表
    @ApiOperation(value = "查询商铺所有部门列表")
    @GetMapping("getDeptList/{shopcode}")
    public Result getDeptList(@PathVariable String shopcode) {
        List<DepartmentVo> list = departmentService.findDeptTree(shopcode);
        return Result.ok(list);
    }

}
